{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\aivin\\Anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py:2785: DtypeWarning: Columns (17,20,22) have mixed types. Specify dtype option on import or set low_memory=False.\n",
      "  interactivity=interactivity, compiler=compiler, result=result)\n"
     ]
    }
   ],
   "source": [
    "from mpl_toolkits.mplot3d import Axes3D\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "df = pd.read_csv(\"http.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data Quality Report\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Data Type</th>\n",
       "      <th>Count</th>\n",
       "      <th>Unique Values</th>\n",
       "      <th>Missing Values</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ts</th>\n",
       "      <td>float64</td>\n",
       "      <td>239357</td>\n",
       "      <td>239344</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>uid</th>\n",
       "      <td>object</td>\n",
       "      <td>239357</td>\n",
       "      <td>107699</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.orig_h</th>\n",
       "      <td>object</td>\n",
       "      <td>239357</td>\n",
       "      <td>128</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.orig_p</th>\n",
       "      <td>int64</td>\n",
       "      <td>239357</td>\n",
       "      <td>1831</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.resp_h</th>\n",
       "      <td>object</td>\n",
       "      <td>239357</td>\n",
       "      <td>16787</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.resp_p</th>\n",
       "      <td>int64</td>\n",
       "      <td>239357</td>\n",
       "      <td>81</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>trans_depth</th>\n",
       "      <td>int64</td>\n",
       "      <td>239357</td>\n",
       "      <td>224</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>method</th>\n",
       "      <td>object</td>\n",
       "      <td>239294</td>\n",
       "      <td>7</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>host</th>\n",
       "      <td>object</td>\n",
       "      <td>237753</td>\n",
       "      <td>15907</td>\n",
       "      <td>1604</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>uri</th>\n",
       "      <td>object</td>\n",
       "      <td>239294</td>\n",
       "      <td>135201</td>\n",
       "      <td>63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>referrer</th>\n",
       "      <td>object</td>\n",
       "      <td>193040</td>\n",
       "      <td>13477</td>\n",
       "      <td>46317</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>user_agent</th>\n",
       "      <td>object</td>\n",
       "      <td>237585</td>\n",
       "      <td>263</td>\n",
       "      <td>1772</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>request_body_len</th>\n",
       "      <td>int64</td>\n",
       "      <td>239357</td>\n",
       "      <td>541</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>response_body_len</th>\n",
       "      <td>int64</td>\n",
       "      <td>239357</td>\n",
       "      <td>40304</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>status_code</th>\n",
       "      <td>float64</td>\n",
       "      <td>237063</td>\n",
       "      <td>28</td>\n",
       "      <td>2294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>status_msg</th>\n",
       "      <td>object</td>\n",
       "      <td>237063</td>\n",
       "      <td>78</td>\n",
       "      <td>2294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>info_code</th>\n",
       "      <td>float64</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>239356</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>info_msg</th>\n",
       "      <td>object</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>239356</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>filename</th>\n",
       "      <td>float64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>239357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>tags</th>\n",
       "      <td>object</td>\n",
       "      <td>239357</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>username</th>\n",
       "      <td>object</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>239348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>password</th>\n",
       "      <td>float64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>239357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>proxied</th>\n",
       "      <td>object</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>239350</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>orig_fuids</th>\n",
       "      <td>object</td>\n",
       "      <td>3364</td>\n",
       "      <td>3364</td>\n",
       "      <td>235993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>orig_mime_types</th>\n",
       "      <td>object</td>\n",
       "      <td>3364</td>\n",
       "      <td>14</td>\n",
       "      <td>235993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>resp_fuids</th>\n",
       "      <td>object</td>\n",
       "      <td>204970</td>\n",
       "      <td>204950</td>\n",
       "      <td>34387</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>resp_mime_types</th>\n",
       "      <td>object</td>\n",
       "      <td>204970</td>\n",
       "      <td>44</td>\n",
       "      <td>34387</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  Data Type   Count Unique Values  Missing Values\n",
       "ts                  float64  239357        239344               0\n",
       "uid                  object  239357        107699               0\n",
       "id.orig_h            object  239357           128               0\n",
       "id.orig_p             int64  239357          1831               0\n",
       "id.resp_h            object  239357         16787               0\n",
       "id.resp_p             int64  239357            81               0\n",
       "trans_depth           int64  239357           224               0\n",
       "method               object  239294             7              63\n",
       "host                 object  237753         15907            1604\n",
       "uri                  object  239294        135201              63\n",
       "referrer             object  193040         13477           46317\n",
       "user_agent           object  237585           263            1772\n",
       "request_body_len      int64  239357           541               0\n",
       "response_body_len     int64  239357         40304               0\n",
       "status_code         float64  237063            28            2294\n",
       "status_msg           object  237063            78            2294\n",
       "info_code           float64       1             1          239356\n",
       "info_msg             object       1             1          239356\n",
       "filename            float64       0             0          239357\n",
       "tags                 object  239357             2               0\n",
       "username             object       9             1          239348\n",
       "password            float64       0             0          239357\n",
       "proxied              object       7             1          239350\n",
       "orig_fuids           object    3364          3364          235993\n",
       "orig_mime_types      object    3364            14          235993\n",
       "resp_fuids           object  204970        204950           34387\n",
       "resp_mime_types      object  204970            44           34387"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#DataFrame with columns\n",
    "columns = pd.DataFrame(list(df.columns.values[1:]))\n",
    "\n",
    "#DataFrame with data types\n",
    "data_types = pd.DataFrame(df.dtypes, columns=['Data Type'])\n",
    "\n",
    "#DataFrame with Count\n",
    "data_count = pd.DataFrame(df.count(), columns=['Count'])\n",
    "\n",
    "#DataFrame with unique values\n",
    "unique_value_counts = pd.DataFrame(columns=['Unique Values'])\n",
    "for v in list(df.columns.values):\n",
    "    unique_value_counts.loc[v] = [df[v].nunique()]\n",
    "\n",
    "missing_data_counts = pd.DataFrame(df.isnull().sum(), columns=['Missing Values'])\n",
    "data_quality_report = data_types.join(data_count).join(unique_value_counts).join(missing_data_counts)\n",
    "print('Data Quality Report')\n",
    "data_quality_report"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
